use super::{blog, idea, token, user};

#[derive(Debug)]
pub enum Request {
    // Grpc messages, send to grpc client module
    UserRegister(user::RegisterRequest),
    UserLogin(user::LoginRequest),
    UserChangePassword(user::ChangePasswordRequest),
    UserUpdate(user::UserInfo),
    UserGet(String),
    UserDelete(String),
    UserLogout(String), // need to notice rauth? Or just delete token?

    // Redis messages, send to redis module
    TokenSet(token::TokenInfo),
    TokenGet(String),
    TokenDelete(String),

    // blog messages, send to grpc client module
    BlogAdd(blog::AddRequest),
    BlogGet(u32),
    BlogUpdate(blog::UpdateRequest),
    BlogDelete(u32),
    BlogsGet(blog::GetMutipleRequest),
    BlogViewInc(u32),
    BlogStarInc(u32),
    BlogStarDec(u32),

    // idea messages, send to grpc client module
    IdeaAdd(idea::AddRequest),
    IdeaGet(u32),
    IdeaUpdate(idea::UpdateRequest),
    IdeaDelete(u32),
    IdeasGet(idea::GetMutipleRequest),
    IdeaViewInc(u32),
    IdeaStarInc(u32),
    IdeaStarDec(u32),
}

#[derive(Debug)]
pub enum Response {
    Ok(),
    Error(String),

    // Response from redis module
    TokenGet(String),

    // Response from grpc client module for user operation
    UserLogin(user::LoginResponse),
    UserGet(user::UserInfo),

    // Response from grpc client module for blog operation
    BlogAdd(u32),
    BlogGet(blog::Blog),
    BlogsGet(blog::GetMutipleResponse),
    Views(u32),
    Stars(u32),

    // Response from grpc client module for idea operation
    IdeaAdd(u32),
    IdeaGet(idea::Idea),
    IdeasGet(idea::GetMutipleResponse),
}
